/*
 *    Copyright 2008-2009 The PoCo Team
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package com.asemantics.poco.parser;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.TimeZone;

import org.testng.annotations.DataProvider;

import com.asemantics.poco.Account;
import com.asemantics.poco.Activity;
import com.asemantics.poco.Address;
import com.asemantics.poco.BodyType;
import com.asemantics.poco.CurrentLocation;
import com.asemantics.poco.DateTime;
import com.asemantics.poco.Drinker;
import com.asemantics.poco.Email;
import com.asemantics.poco.Entry;
import com.asemantics.poco.Gender;
import com.asemantics.poco.IM;
import com.asemantics.poco.MediaItem;
import com.asemantics.poco.MediaItemType;
import com.asemantics.poco.Name;
import com.asemantics.poco.OSUrl;
import com.asemantics.poco.Organization;
import com.asemantics.poco.PhoneNumber;
import com.asemantics.poco.Photo;
import com.asemantics.poco.Response;
import com.asemantics.poco.Smoker;
import com.asemantics.poco.Url;

/**
 * 
 * @author Simone Tripodi
 * @author Michele Mostarda (michele.mostarda@gmail.com)
 * @version $Id: ResponseDataProvider.java 264 2009-12-20 01:35:31Z simone.tripodi@gmail.com $
 */
public final class ResponseDataProvider {

    @DataProvider
    public static Object[][] createResponseDataProvider() throws MalformedURLException {
        Response response = new Response();
        response.setStartIndex(10);
        response.setItemsPerPage(10);
        response.setTotalResults(12);

        //
        Entry minimal = new Entry();
        minimal.setId("123");
        minimal.setDisplayName("Minimal Contact");
        response.addEntry(minimal);

        //
        Entry hashimoto = new Entry();
        hashimoto.setId("703887");
        hashimoto.setDisplayName("Mork Hashimoto");
        hashimoto.setAboutMe("Simply the best!");

        Name name = new Name();
        name.setFamilyName("Hashimoto");
        name.setGivenName("Mork");
        hashimoto.setName(name);

        CurrentLocation currentLocation = new CurrentLocation();
        currentLocation.setType("home");
        currentLocation.setStreetAddress("742 Evergreen Terrace\nSuite 123");
        currentLocation.setLocality("Springfield");
        currentLocation.setRegion("VT");
        currentLocation.setPostalCode("12345");
        currentLocation.setCountry("USA");
        currentLocation.setFormatted("742 Evergreen Terrace\nSuite 123\nSpringfield, VT 12345 USA");
        currentLocation.setExtendedAddress("742 Evergreen Terrace\nSuite 123\nSpringfield, VT 12345 USA");
        currentLocation.setPoBox("12345");
        currentLocation.setPrimary(true);
        currentLocation.setLatitude(38.092988);
        currentLocation.setLongitude(93.164063);
        hashimoto.setCurrentLocation(currentLocation);

        MediaItem mediaItem = new MediaItem();
        mediaItem.setMediaItemType(MediaItemType.video);
        mediaItem.setMimeType("video/mpeg");
        try {
            mediaItem.setUrl(new URL("http://portablecontacts.net/video.mpg"));
        } catch (MalformedURLException e) {
        }

        Activity activity = new Activity();
        activity.setAppId("appId");
        activity.setBody("body");
        activity.setBodyId("bodyId");
        activity.setExternalId("externalId");
        activity.setId("id");
        activity.setPostedTime(1234);
        activity.setPriority(100);
        activity.setStreamTitle("streamTitle");
        activity.setTitle("title");
        activity.setTitleId("titleId");
        activity.setUserId("userId");
        try {
            activity.setStreamFaviconUrl(new URL("http://portablecontacts.net/setStreamFaviconUrl"));
            activity.setStreamSourceUrl(new URL("http://portablecontacts.net/setStreamSourceUrl"));
            activity.setStreamUrl(new URL("http://portablecontacts.net/setStreamUrl"));
            activity.setUrl(new URL("http://portablecontacts.net/setUrl"));
        } catch (MalformedURLException e) {
        }
        activity.addMediaItem(mediaItem);
        hashimoto.addActivity(activity);

        BodyType bodyType = new BodyType();
        bodyType.setBuild("");
        bodyType.setEyeColor("Blue");
        bodyType.setHairColor("Blonde");
        bodyType.setHeight(1.76);
        bodyType.setWeight(76);
        hashimoto.setBodyType(bodyType);

        hashimoto.setDrinker(Drinker.heavily);
        hashimoto.setSmoker(Smoker.no);

        Calendar calendar = new GregorianCalendar(1, 0, 16, 0, 0, 0);
        hashimoto.setBirthday(calendar.getTime());

        hashimoto.setGender(Gender.male);
        hashimoto.addTag("plaxo guy");

        Email email = new Email();
        email.setValue("mhashimoto-04@plaxo.com");
        email.setType("work");
        email.setPrimary(true);
        hashimoto.addEmail(email);

        email = new Email();
        email.setValue("mhashimoto-04@plaxo.com");
        email.setType("home");
        hashimoto.addEmail(email);

        email = new Email();
        email.setValue("mhashimoto@plaxo.com");
        email.setType("home");
        hashimoto.addEmail(email);

        Url url = new Url();
        url.setValue("http://www.seeyellow.com");
        url.setType("work");
        hashimoto.addUrl(url);

        url = new Url();
        url.setValue("http://www.angryalien.com");
        url.setType("home");
        hashimoto.addUrl(url);

        PhoneNumber phoneNumber = new PhoneNumber();
        phoneNumber.setValue("KLONDIKE5");
        phoneNumber.setType("work");
        hashimoto.addPhoneNumber(phoneNumber);

        phoneNumber = new PhoneNumber();
        phoneNumber.setValue("650-123-4567");
        phoneNumber.setType("mobile");
        hashimoto.addPhoneNumber(phoneNumber);

        Photo photo = new Photo();
        photo.setValue("http://sample.site.org/photos/12345.jpg");
        photo.setType("thumbnail");
        hashimoto.addPhoto(photo);

        IM im = new IM();
        im.setValue("plaxodev8");
        im.setType("aim");
        hashimoto.addIM(im);

        Address address = new Address();
        address.setType("home");
        address.setStreetAddress("742 Evergreen Terrace\nSuite 123");
        address.setLocality("Springfield");
        address.setRegion("VT");
        address.setPostalCode("12345");
        address.setCountry("USA");
        address.setFormatted("742 Evergreen Terrace\nSuite 123\nSpringfield, VT 12345 USA");
        hashimoto.addAddress(address);

        Organization organization = new Organization();
        organization.setName("Burns Worldwide");
        organization.setTitle("Head Bee Guy");
        hashimoto.addOrganization(organization);

        Account account = new Account();
        account.setDomain("plaxo.com");
        account.setUserid("2706");
        hashimoto.addAccount(account);

        response.addEntry(hashimoto);
        response.addEntry( (Entry) createCompleteEntry()[0][0] );

        return new Object[][] {
                { response }
        };
    }

    @DataProvider
    public static Object[][] createCompleteEntry() throws MalformedURLException {
        Entry entry = new Entry();
        entry.setId("1000");
        entry.setDisplayName("Pinco Pallino");

        Name name = new Name();
        name.setFamilyName("Pallino");
        name.setGivenName("Pinco");
        name.setMiddleName("Jr");
        name.setHonorificPrefix("Mr");
        name.setHonorificSuffix("Suff");
        entry.setName(name);

        entry.setNickname("pincopal");

        Calendar publishedCalendar = new GregorianCalendar(2008, GregorianCalendar.JANUARY, 23, 4, 56, 22);
        DateTime published = new DateTime( publishedCalendar.getTime(), TimeZone.getTimeZone("GMT") );
        entry.setPublished( published );

        Calendar updatedCalendar = new GregorianCalendar(2008, GregorianCalendar.JANUARY, 25, 4, 56, 22);
        DateTime updated = new DateTime( updatedCalendar.getTime(), TimeZone.getTimeZone("GMT") );
        entry.setUpdated( updated );

        Calendar birthdayCalendar = new GregorianCalendar(1979, GregorianCalendar.SEPTEMBER, 23);
        entry.setBirthday( birthdayCalendar.getTime() );

        Calendar anniversaryCalendar = new GregorianCalendar(1979, GregorianCalendar.SEPTEMBER, 23);
        entry.setAnniversary( anniversaryCalendar.getTime() );

        entry.setGender(Gender.male);

        entry.setNote("Nothing to add...");

        entry.setPreferredUsername("pincopal79");

        entry.setUtcOffset(TimeZone.getTimeZone("GMT+01"));

        entry.setConnected(true);

        entry.setAboutMe("Nothing to say...");

        BodyType bodyType = new BodyType();
        bodyType.setBuild("thin");
        bodyType.setEyeColor("Blue");
        bodyType.setHairColor("Blonde");
        bodyType.setHeight(1.76);
        bodyType.setWeight(76);
        entry.setBodyType(bodyType);

        CurrentLocation currentLocation = new CurrentLocation();
        currentLocation.setCountry("pinconia");
        currentLocation.setExtendedAddress("main street 1");
        currentLocation.setLatitude(10);
        currentLocation.setLocality("Svitonia");
        currentLocation.setLongitude(20);
        currentLocation.setPoBox("my-po-box");
        currentLocation.setPostalCode("1245");
        currentLocation.setRegion("Regionia");
        currentLocation.setStreetAddress("Another address");
        currentLocation.setType("work");
        currentLocation.setUnstructuredAddress("unstructured street 1");
        entry.setCurrentLocation(currentLocation);

        entry.setDrinker(Drinker.regularly);

        entry.setEthnicity("caucasian");

        entry.setFashion("no fashion");

        entry.setHappiestWhen("things work");

        entry.setHumor("bitter");

        entry.setLivingArrangement("apartment");

        entry.setLookingFor("drugs");

        OSUrl profileSong = new OSUrl();
        profileSong.setAddress("http://path.to.song");
        profileSong.setLinkText("my favourite song");
        profileSong.setType("music");
        entry.setProfileSong( profileSong );

        OSUrl profileVideo = new OSUrl();
        profileVideo.setAddress("http://path.to.video");
        profileVideo.setLinkText("my favourite video");
        profileVideo.setType("video");
        entry.setProfileVideo( profileVideo );

        entry.setRelationshipStatus("single");

        entry.setReligion("pagan");

        entry.setRomance("what?");

        entry.setScaredOf("caxisms");

        entry.setSexualOrientation("heterosexual");

        entry.setSmoker(Smoker.no);

        entry.setStatus("working...");

        Email email1 = new Email();
        email1.setPrimary(true);
        email1.setValue("pinco@pallino.it");
        email1.setType("work");
        entry.addEmail(email1);

        Email email2 = new Email();
        email2.setPrimary(false);
        email2.setValue("pincofoo@pallino.it");
        email2.setType("fun");
        entry.addEmail(email2);

        Url url1 = new Url();
        url1.setValue("http://pinco.pallino.it");
        url1.setType("work");
        url1.setPrimary(false);
        entry.addUrl(url1);

        Url url2 = new Url();
        url2.setValue("http://pincofoo.pallino.it");
        url2.setType("fun");
        url2.setPrimary(true);
        entry.addUrl(url2);

        PhoneNumber phoneNumber1 = new PhoneNumber();
        phoneNumber1.setValue("123456789");
        phoneNumber1.setType("work");
        phoneNumber1.setPrimary(false);
        entry.addPhoneNumber(phoneNumber1);

        PhoneNumber phoneNumber2 = new PhoneNumber();
        phoneNumber2.setValue("987654321");
        phoneNumber2.setType("fun");
        phoneNumber2.setPrimary(true);
        entry.addPhoneNumber(phoneNumber2);

        IM im1 = new IM();
        im1.setValue("pinker");
        im1.setType("job");
        im1.setPrimary(false);
        entry.addIM(im1);

        IM im2 = new IM();
        im2.setValue("pinkoo");
        im2.setType("fun");
        im2.setPrimary(true);
        entry.addIM(im2);

        Photo photo1 = new Photo();
        photo1.setValue("http://photos.pinco.it");
        photo1.setType("work");
        photo1.setPrimary(false);
        entry.addPhoto(photo1);

        Photo photo2 = new Photo();
        photo2.setValue("http://photos.pallino.it");
        photo2.setType("fun");
        photo2.setPrimary(true);
        entry.addPhoto(photo2);

        entry.addTag("pinco");
        entry.addTag("foo");

        entry.addRelationship("pinca");
        entry.addRelationship("pallina");

        Address address1 = new Address();
        address1.setCountry("Pinconia");
        address1.setFormatted("P I N C O N I A");
        address1.setLocality("Pincopola");
        address1.setPostalCode("123");
        address1.setRegion("Pincania");
        address1.setStreetAddress("Via di Pinco Pallino");
        address1.setType("work");
        entry.addAddress(address1);

        Address address2 = new Address();
        address2.setCountry("Pallinia");
        address2.setFormatted("P A L L I N I A");
        address2.setLocality("Pallina");
        address2.setPostalCode("321");
        address2.setRegion("Pallonia");
        address2.setStreetAddress("Via di Mezzo");
        address2.setType("home");
        entry.addAddress(address2);

        Organization organization1 = new Organization();
        organization1.setName("pincorg");
        organization1.setDepartment("Org Dept");
        organization1.setTitle("The Pinco Org");
        organization1.setType("organization");
        Calendar org1StartDateCalendar = new GregorianCalendar(2008, GregorianCalendar.JANUARY, 1);
        DateTime org1StartDate = new DateTime( org1StartDateCalendar.getTime(), TimeZone.getTimeZone("GMT") );
        organization1.setStartDate(org1StartDate.getDate());
        Calendar org1EndDateCalendar = new GregorianCalendar(2008, GregorianCalendar.JANUARY, 2);
        DateTime org1EndDate = new DateTime( org1EndDateCalendar.getTime(), TimeZone.getTimeZone("GMT") );
        organization1.setEndDate(org1EndDate.getDate());
        organization1.setLocation("Org Dept Location");
        organization1.setDescription("The Pinco Org desc");
        entry.addOrganization(organization1);

        Organization organization2 = new Organization();
        organization2.setName("pincom");
        organization2.setDepartment("Com Dept");
        organization2.setTitle("The Pinco Com");
        organization2.setType("commercial");
        Calendar org2StartDateCalendar = new GregorianCalendar(2008, GregorianCalendar.JANUARY, 3);
        DateTime org2StartDate = new DateTime( org2StartDateCalendar.getTime(), TimeZone.getTimeZone("GMT") );
        organization2.setStartDate(org2StartDate.getDate());
        Calendar org2EndDateCalendar = new GregorianCalendar(2008, GregorianCalendar.JANUARY,4);
        DateTime org2EndDate = new DateTime( org2EndDateCalendar.getTime(), TimeZone.getTimeZone("GMT") );
        organization2.setEndDate(org2EndDate.getDate());
        organization2.setLocation("Com Dept Location");
        organization2.setDescription("The Pinco Com desc");
        entry.addOrganization(organization2);

        Account account1 = new Account();
        account1.setDomain("pincodom");
        account1.setUsername("pinco");
        account1.setUserid("pincox");
        entry.addAccount(account1);

        Account account2 = new Account();
        account2.setDomain("pallinodom");
        account2.setUsername("pallino");
        account2.setUserid("pallinox");
        entry.addAccount(account2);

        Activity activity = new Activity();
        activity.setAppId("Appo");
        activity.setBody("Body");
        activity.setBodyId("BodyID");
        activity.setExternalId("ExternalID");
        activity.setId("ID");
        activity.setPostedTime(1244848849);
        activity.setPriority(1);
        activity.setStreamFaviconUrl( new URL("http://favicon.pincopal.it") );
        activity.setStreamSourceUrl( new URL("http://source.pincopal.it") );
        activity.setStreamTitle("The Stream");
        activity.setStreamUrl( new URL("http://stream.pincopal.it") );
        activity.setTitle("The Title");
        activity.setTitleId("TitleID");
        activity.setUrl( new URL("http://url.pincopal.it") );
        activity.setUserId("my.userid.pincopal.it");
        MediaItem mediaItem = new MediaItem();
        mediaItem.setMediaItemType(MediaItemType.video);
        mediaItem.setMimeType("video/avi");
        mediaItem.setUrl( new URL("http://video.pincopallino.it") );
        activity.addMediaItem(mediaItem);
        entry.addActivity(activity);

        entry.addBook("The donkey whisperer");
        entry.addBook("Go crazy in 10 days");

        entry.addCar("BMW");
        entry.addCar("Alfa-Romeo");

        entry.addChild("Bimbo Mix");
        entry.addChild("Bimba Mix");

        entry.addFood("gnocchi");
        entry.addFood("lasagne");

        entry.addHero("Spider Duck");
        entry.addHero("Monkey Rat");

        entry.addInterest("End this test");
        entry.addInterest("Survive this test");

        entry.addJobInterest("Java");
        entry.addJobInterest("Bava");

        entry.addLanguageSpoken("Pinco");
        entry.addLanguageSpoken("Pallian");

        entry.addMovie("The horrorific death test");
        entry.addMovie("The horrorific death test - resurrection");

        entry.addMusic("Zum pa ppa");
        entry.addMusic("Plin Plin");

        entry.addPet("donkey");
        entry.addPet("monkey");

        entry.addPoliticalView("democracy");
        entry.addPoliticalView("meritocracy");

        entry.addQuote("boh");
        entry.addQuote("bah");

        entry.addSport("pizza");
        entry.addSport("fichi");

        entry.addTurnOff("toff1");
        entry.addTurnOff("toff2");

        entry.addTurnOn("ton1");
        entry.addTurnOn("ton2");

        entry.addTvShow("Ending Test Today");
        entry.addTvShow("The Test is Ended");

        return new Object[][]{
                {entry}
        };
    }

}
